package com.example.controller;

import com.example.common.Pager;
import com.example.common.Result;
import com.example.entity.Dept;
import com.example.entity.VolunteerMessage;
import com.example.service.DeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @author 紫煦桉
 */
@RequestMapping("/volunteerMessage")
@Controller
public class VolunteerMessageController extends SuperController<VolunteerMessage> {

    private DeptService deptService;
    @Autowired
    private void setService(DeptService deptService) {
        this.deptService = deptService;
    }

    @RequestMapping("/deptList")
    @ResponseBody
    public List<Dept> allDept() {
        return deptService.findAll();
    }

    @Override
    @RequestMapping("/list")
    @ResponseBody
    public Pager<VolunteerMessage> list(VolunteerMessage param, @RequestParam(defaultValue = "1", value = "page") String page,
                                        @RequestParam(defaultValue = "10", value = "rows") String size) {
        return super.list(param, page, size);
    }

    @Override
    @RequestMapping("/add")
    @ResponseBody
    public Result add(VolunteerMessage param) {
        return super.add(param);
    }

    @Override
    @RequestMapping("/edit")
    @ResponseBody
    public Result edit(VolunteerMessage param) {
        return super.edit(param);
    }

    @Override
    @RequestMapping("/delete")
    @ResponseBody
    public Result delete(VolunteerMessage param) {
        return super.delete(param);
    }
}
